/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     struct TreeNode *left;
 *     struct TreeNode *right;
 * };
 */


int minDepth(struct TreeNode* root){
    if(NULL == root)
        return 0;

    if (root->left == NULL && root->right == NULL) {
        return 1;
    }
    int min = INT_MAX;
    if(root->left != NULL)
        min = fmin(minDepth(root->left), min) ;
	if(root->right != NULL)
        min = fmin(minDepth(root->right), min) ;

	return min+1;
}